            -*- html -*-

    NkPBX Sample Application


@author Carlos Gonzalez Florido <carlosj.gf@gmail.com>
@copyright 2015 Carlos Gonzalez Florido
@version 0.5.0
@title NkPBX Sample Application

@doc This Erlang application is a <i>SipApp</i> implementing a basic PBX-like SIP proxy application with some extras. Its purpose is to demostrate the use of NkSIP SipApps. it starts a new SipApp named `pbx' listening on all of the host's interfaces, port 5060 for tcp and udp protocols and 5061 for tls. 

Any SIP endpoint can register with the server, using any user, domain "nksip" or "127.0.0.1" (you can add more domains in {@link nksip_pbx_sipapp}), and password "1234" (for exmple "100@nksip").

From this moment on, any endpoint can <i>call</i> any other using its registered name (or <i>address-of-record</i>) through the proxy. NkPBX starts to monitor in background each registered endpoint, measuring its response time with periodic <i>OPTION</i> requests.

There are some special addresses or "extensions" available:

<table border="1">
  <tr><th>Extension</th><th>Description</th></tr>
  <tr>
  	<td>`200@nksip'</td>
  	<td>Send the call in parallel to all registered endpoints but me, including
  	    a <i>Record-Route</i>, so all dialog requests will go through this proxy.</td>
  </tr>
  <tr>
  	<td>`201@nksip'</td>
  	<td>Send the call in parallel to each two random registered endpoints. 
  		Include a custom header but no <i>Record-Route</i>, so next dialog requests 
  		will go directly to the endpoint.</td>
  </tr>
  <tr>
  	<td>`202@nksip'</td>
  	<td>Send the request to the <i>fastest</i> registered endpoint.</td>
  </tr>
  <tr>
  	<td>`203@nksip'</td>
  	<td>Send the request to the <i>slowest</i> registered endpoint.</td>
  </tr>
  <tr>
  	<td>`(any)@nksip'</td>
  	<td>If this contact is registered, send the call to it.</td>
  </tr>
  <tr>
  	<td>`nksip'</td>
  	<td>Process the request in the proxy. Since we have not implemented `invite/4', 
  		`options/4', etc. callback functions, all responses will be default responses
  		as defined in `nksip_sipapp'). <i>REGISTER</i> requests will be processed 
  		as configured when starting the SipApp.</td>
  </tr>
</table>


Feel free to use the functions {@link nksip_pbx:trace/1} to start or stop the trace of
SIP messages to console or {@link nksip_pbx:loglevel/1} ro change the console log level. 

Use the function {@link nksip_pbx_sipapp:check_speed/1} to stop the automatic generation of
<i>OPTION</i> requests.
